<template>
  <div class="login_container">
    <h1 class="textes">Welcome</h1>
    <div class="inp">
      <van-icon class="icon1" name="manager-o" />
      <input v-model="name"  class="topinp" type="text" />
      <van-icon class="icon2" name="closed-eye" />
      <input v-model="val" type="password" />
    </div>
    <van-row gutter="1">
      <van-col span="12">
        <van-button color="linear-gradient(to right, #F67ABF, #2799CC)" @click="handel">登录</van-button>
      </van-col>
      <van-col span="12">
        <van-button color="linear-gradient(to right, #CEB4BD, #239B4B)" @click="handel2">重置</van-button>
      </van-col>
    </van-row>

  </div>
</template>

<script>
export default {
  data() {
    return {
      val: "123456",
      name: "admin"
    };
  },
  methods: {
    handel() {
      if (this.val.trim().length !== 0) {
        window.sessionStorage.setItem('token',this.val)
        this.$router.push("/home");
      }
    },
    handel2() {
      this.val = "";
    }
  },
  created() {
    this.$store.commit("setIfShow", false);
  }
};
</script>

<style lang="less" scoped>
.textes {
  font-size: 3rem;
  color: #fff;
  text-align: center;
  margin-top: 5rem;
  margin: 0;
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.login_container {
  background: linear-gradient(to top, #51d1c4, #f4cfc9, skyblue);
  height: 100%;
}

input {
  width: 20rem;
  height: 2rem;
  outline: none;
  background: transparent;
  background-color: none;
  padding-left: 2rem;
  border: 0.1rem solid #fff;
  font-size: 0.12rem;
  border-radius: 1rem;
  outline: none;
}

.inp {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  .topinp {
    margin-bottom: 0.8rem;
  }
}
.icon1 {
  position: absolute;
  top: 0.4rem;
  left: 0.6rem;
}
.icon2 {
  position: absolute;
  top: 3.3rem;
  left: 0.6rem;
}

.van-button {
  width: 5rem;
  margin-left: 2.5rem;
  border-radius: 25%;
}
.van-row {
  position: absolute;
  top: 70%;
  left: 50%;
  transform: translate(-65%,-50%)
}
</style>